import unittest
from ddt import ddt, data


@ddt
class TestCases2(unittest.TestCase):

    @classmethod
    def setUpClass(cls) -> None:
        print('所有用例的前置')

    @classmethod
    def tearDownClass(cls) -> None:
        print('所有用例的后置')

    def setUp(self) -> None:
        print('每个用例前置')

    def tearDown(self) -> None:
        print('每个用例的后置')
    @data('username01', 'username02')
    def test04(self, username):
        """冒烟用例"""
        print('执行用例4',username)

    def test03(self):
        """爆炸用例"""
        print('执行用例3')



if __name__ == '__main__':
    # 创建类加载对象
    load = unittest.TestLoader()
    # 分别加载两个类
    suit2 = load.loadTestsFromTestCase(TestCases2)
    # 放在套件里
    suits = unittest.TestSuite([suit2])

    run = unittest.TextTestRunner()
    run.run(suits)

